const EventEmitter = require('events');

const myEmitter = new EventEmitter();

function bind (n){
  myEmitter.once('add' + n, ()=>{
    console.log('event success ' + n);
  });
}

for(let i=0;i<100000;i++){
  bind(i)
}

console.log('add over');

setTimeout(()=>{
  console.log(myEmitter.eventNames().length);
}, 10000)